class Projectuser < ActiveRecord::Base
	belongs_to :project
	belongs_to :user
  def self.count_users_by_project_id(project_id)
      Projectuser.count :conditions =>["project_id =?",project_id]
  end
  
  def self.max(project_id)
      Projectuser.maximum :point,:conditions => ["project_id=?",project_id]
  end
  def self.min(project_id)
      Projectuser.minimum :point,:conditions => ["project_id=?",project_id]
  end
  def self.avg(project_id)
      Projectuser.average :point,:conditions => ["project_id=?",project_id]
  end

    def self.total(project_id)
      Projectuser.sum :point,:conditions => ["project_id=?",project_id]
  end



end
